package com.tianyi.utils;

import java.io.File;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class StaJavaFile {
	private static int count=0;
	public static int find(String path,String reg){
		Pattern pat=Pattern.compile(reg);  
		File file=new File(path);
		File[] arr=file.listFiles();
		for(int i=0;i<arr.length;i++){  
            if(arr[i].isDirectory()){  
                find(arr[i].getAbsolutePath(),reg);  
            }  
            Matcher mat=pat.matcher(arr[i].getAbsolutePath());  
            if(mat.matches()){  
                System.out.println(arr[i].getAbsolutePath());  
                count++;
            }  
        }  
		return count;
	}
}
